package com.yty.product.entity;

import com.yty.product.apidata.ProductInfoOutput;
import com.yty.product.vo.ProductInfoVO;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class ProductInfo {
    private Long id;

    private String productId;

    private String productName;

    private BigDecimal productPrice;

    private Integer productStock;

    private String productDescription;

    private String productIcon;

    private Byte productStatus;

    private Integer categoryType;

    private Date createTime;

    private Date updateTime;

    /**
     * 转化为productInfoVo
     *
     * @return
     */
    public ProductInfoVO toProductInfoVo() {
        ProductInfoVO productInfoVO = new ProductInfoVO();
        productInfoVO.setId(productId);
        productInfoVO.setName(productName);
        productInfoVO.setPrice(productPrice);
        productInfoVO.setDescription(productDescription);
        productInfoVO.setIcon(productIcon);
        return productInfoVO;
    }

    /**
     * 转化为output
     *
     * @return
     */
    public ProductInfoOutput toProductInfoOutput() {
        ProductInfoOutput productInfoOutput = new ProductInfoOutput();
        productInfoOutput.setCategoryType(categoryType);
        productInfoOutput.setProductDescription(productDescription);
        productInfoOutput.setProductIcon(productIcon);
        productInfoOutput.setProductId(productId);
        productInfoOutput.setProductName(productName);
        productInfoOutput.setProductPrice(productPrice);
        return productInfoOutput;
    }
}